< previous page page_68 next page >

Page 68
Instead of reviewing strengths and limitations of the Snapshot data object, let's look at these two properties of Snapshots in depth.
Snapshot-Type Recordset Storage
You need to consider several things when using Snapshot data objects. For example, unlike Visual Basic Dynasets, Snapshot objects are stored entirely at the workstation. If you create a Snapshot that contains 500 data records, all 500 records are sent from the data table directly to your workstation and loaded into RAM memory. If the workstation does not have enough RAM available, the records are stored in a temporary file on a local disk drive.
Because all the requested records are loaded on the local machine, initial requests for data can take longer with Snapshots than with Dynasets. However, when the data records are retrieved and stored locally, subsequent access to records within the Snapshot object is faster than with the Dynaset object. Also, because all records must be stored locally, you must be careful not to request too large a dataset; you might quickly run out of local RAM or disk space.
Snapshots are static views of the underlying data tables. If you request a set of data records in a Snapshot object, and then someone deletes several records from the underlying data table, the Snapshot dataset does not reflect the changes in the underlying table. The only way you can learn about the changes in the underlying data tables is to create a new Snapshot by making a new request.
Snapshot-Type Recordsets Are Read-Only Data Objects
Visual Basic Snapshots are read-only data objects. You cannot use Snapshots to update data tables. You can only use them to view data. This is because Snapshots are actually a copy of the data records created at your local workstation.
The project in Listing 3.14 illustrates the static aspect of Snapshot data objects compared to the dynamic aspect of Dynaset and Table data objects. Start a new Standard EXE project. There are no controls in this project, so be sure to add the Microsoft DAO 3.5 Object Library to access the data objects.
The entire source code is listed. Enter it into a single form and save it as SNAPSHOTS.FRM and SNAPSHOTS.VBP.
Type.gifListing 3.14. Comparing Snapshot-type and Dynaset-type Recordsets.
Option Explicit
'
' form level variables
'

 
< previous page page_68 next page >

If you like this book, buy it!